NOTE

Elasticsearch Segment Merging

Why immutable Lucene segments are merged, how deletes are reclaimed, and the I/O/CPU trade-offs.

Elasticsearch / SearchCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

Lucene writes immutable segments. Over time Elasticsearch/Lucene merges smaller segments into larger ones, reducing segment count and reclaiming space from deleted/updated documents whose old versions are no longer needed.

Merging consumes disk bandwidth, CPU, and temporary storage and can compete with indexing/search. The merge policy and scheduler manage that trade-off automatically.

Force-merge is mainly appropriate for read-only indices after writes have stopped; repeatedly forcing active indices can create unnecessary work and very large segments.

Loading helpful count